<?php
/**
 * Created by PhpStorm.
 * User: mf
 * Date: 2017/9/4
 * Time: 11:25
 */
namespace app\admin\controller;

use think\Request;
use app\admin\logic\User as LogicUser;
use tool\Common;

class User extends Base
{
    //商家申请入驻
    public function sellerApply()
    {
        $data = [
            'username' => 'test20',
            'password' => '123456',
            'repassword' => '123456',
            'sellerName' => '安徽小猪cms科技有限公司',
            'mobile' => 17682318891,
            'mobileCode' => 1234,
            'email' => '897730106@qq.com',
            'address' => '安徽省合肥市经开区'
        ];
        //$data = Request::instance()->post();
        $user = new LogicUser();
        $res = $user->init($data)->sellerApply();
        Common::json($res);
    }

    //得到商家的注册信息
    public function getSellerMsg()
    {
        $data = [
            'sellerID' => 25
        ];
        //$data = Request::instance()->post();
        $user = new LogicUser();
        $res = $user->init($data)->getSellerMsg();
        Common::json($res);
    }

    //完善商家信息
    public function addSellerMsg()
    {
        $data = [
            'contactman' => '段总',
            'bankName' => '中国银行',
            'bankCardNum' => '123456789987456',
            'description' => '这是公司的简介',
            'comment' => '这是公司的备注',
            'certificate' => 'http://www.baidu.com.url.2',
            'range' => '消防器材sss',
            'logo' => 'http://www.baidu.com.url'
        ];
        //$data = Request::instance()->post();
        $user = new LogicUser();
        $res = $user->init($data)->addSellerMsg();
        Common::json($res);
    }

    //用户登录
    public function login()
    {
        $data = [
            'username' => 'mengfeng',
            'password' => '123456'
        ];
        //$data = Request::instance()->post();
        $user = new LogicUser();
        $res = $user->init($data)->login();
        Common::json($res);
    }

    //用户退出
    public function logout()
    {
        $user = new LogicUser();
        $res = $user->logout();
        Common::json($res);
    }

    //谦程网络添加支队和分队账户
    public function addTeam()
    {
        $data = [
            'parentID' => 0,
            'username' => 'test18',
            'password' => 123456,
            'teamName' => '湖州消防支队'
        ];
        //$data = Request::instance()->post();
        $user = new LogicUser();
        $res = $user->init($data)->addTeam();
        Common::json($res);
    }

    //总队得到支队列表
    public function getSonTeamList()
    {
        $user = new LogicUser();
        $res = $user->getSonTeamList();
        Common::json($res);
    }
}